// ==========================================================================
// Horizontal bar list
// ==========================================================================
@import "../styles/typography";
@import "./stats-variables";

.horizontal-bar-list {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: $row-font-size;
	font-weight: 500;
	line-height: $row-line-height;

	.horizontal-bar-list-item {
		display: flex;
		justify-content: space-between;
		min-height: $row-height;
		align-items: stretch;
		box-sizing: border-box;
		padding: 0 $padding-outside;
		transition: background-color $item-transition;

		& + .horizontal-bar-list-item {
			margin-top: $space-between-rows;
		}

		&:hover,
		&:focus {
			background-color: var(--theme-highlight-color);
			color: var(--studio-white);

			@media (min-width: 481px) {
				svg {
					fill: var(--studio-white);
				}

				a,
				button {
					color: var(--studio-white);
				}
			}

			.horizontal-bar-list--hover-action {
				display: block;
			}

			.horizontal-bar-list-label {
				color: var(--studio-white);
			}

			.stats-list-actions__mobile-toggle {
				.stats-icon {
					fill: var(--studio-white);
				}
			}
		}

		.stats-list-actions__mobile-toggle {
			&:focus {
				.stats-icon {
					outline: dotted 1px var(--studio-white);
				}
			}
		}
	}

	.horizontal-bar-list-group {
		margin-left: $stats-child-hover-indentation;
	}

	.horizontal-bar-list-item-bar {
		padding-left: $bar-left-spacing;
		position: relative;
		display: flex;
		height: auto;
		width: calc(100% - $value-column-width - $bar-left-spacing);
		align-items: center;
		flex: 1 0 auto;

		&::before {
			width: var(--horizontal-bar-list-fill);
			height: 100%;
			content: "";
			border-radius: 2px;
			background-color: color-mix(in srgb, var(--color-primary) 15%, transparent);
			position: absolute;
			left: 0;
			z-index: 0;
			transition: background-color $item-transition;
		}
	}

	.horizontal-bar-list--hover-action {
		display: none;
		position: relative;
	}

	.horizontal-bar-list-label {
		text-overflow: ellipsis;
		overflow: hidden;
		white-space: nowrap;
		z-index: 1;
		color: var(--color-text);
		flex: 1;
	}

	.horizontal-bar-list-label--group-header {
		display: flex;
		align-items: center;
	}

	.value {
		flex: 0 0 $value-column-width;
		text-align: right;
		align-self: center;
	}
}

.horizontal-bar-list-item--link {
	cursor: pointer;
}

.horizontal-bar-list-item--link-underlined {
	a {
		font-weight: 400;
		text-decoration: underline;
	}
}

.horizontal-bar-list-item--indicated {
	box-shadow: inset $item-indicator-width 0 0 var(--color-primary);
}

.horizontal-bar-list-item--static {
	cursor: auto;
}

.horizontal-bar-list-item--no-bg {
	.horizontal-bar-list-item-bar {
		padding-left: 0;

		&::before {
			display: none;
		}
	}
}

.horizontal-bar-list-item--additional {
	@include additional-columns-wrapper;
}

.horizontal-bar-list-item__left-icon {
	padding-right: 8px;
	display: flex;
}

.horizontal-bar-list-group {
	list-style: none;
	margin: $space-between-rows 0 ($space-between-rows * 2) 0;
}

.horizontal-bar-list-group-toggle {
	position: relative;
	top: 2px;
}

.horizontal-bar-list__group-label {
	position: relative;
	overflow: hidden;
	text-overflow: ellipsis;

	> svg,
	> span {
		vertical-align: middle;
	}

	> svg + span {
		padding: 8px;
	}

	> span + svg {
		padding-left: 17px;
	}
}
